package com.trkj.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.sql.Timestamp;
import java.util.List;


/**
 * The persistent class for the ADMISSION database table.
 * 
 */
@Entity
@NamedQuery(name="Admission.findAll", query="SELECT a FROM Admission a")
public class Admission implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="ADMISSION_ADMID_GENERATOR", sequenceName="HR")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ADMISSION_ADMID_GENERATOR")
	@Column(name="ADM_ID")
	private long admId;

	@Column(name="ADM_DATE")
	private Timestamp admDate;

	@Column(name="ADM_PERSON")
	private String admPerson;

	@Column(name="ADM_REMARK")
	private String admRemark;

	//bi-directional many-to-one association to StaffInformation
	@ManyToOne
	@JoinColumn(name="STAIN_ID")
	private StaffInformation staffInformation;

	//bi-directional many-to-one association to ExamGrade
	@OneToMany(mappedBy="admission")
	@JSONField(serialize=false)
	private List<ExamGrade> examGrades;

	public Admission() {
	}

	public long getAdmId() {
		return this.admId;
	}

	public void setAdmId(long admId) {
		this.admId = admId;
	}

	public Timestamp getAdmDate() {
		return this.admDate;
	}

	public void setAdmDate(Timestamp admDate) {
		this.admDate = admDate;
	}

	public String getAdmPerson() {
		return this.admPerson;
	}

	public void setAdmPerson(String admPerson) {
		this.admPerson = admPerson;
	}

	public String getAdmRemark() {
		return this.admRemark;
	}

	public void setAdmRemark(String admRemark) {
		this.admRemark = admRemark;
	}

	public StaffInformation getStaffInformation() {
		return this.staffInformation;
	}

	public void setStaffInformation(StaffInformation staffInformation) {
		this.staffInformation = staffInformation;
	}

	public List<ExamGrade> getExamGrades() {
		return this.examGrades;
	}

	public void setExamGrades(List<ExamGrade> examGrades) {
		this.examGrades = examGrades;
	}

	public ExamGrade addExamGrade(ExamGrade examGrade) {
		getExamGrades().add(examGrade);
		examGrade.setAdmission(this);

		return examGrade;
	}

	public ExamGrade removeExamGrade(ExamGrade examGrade) {
		getExamGrades().remove(examGrade);
		examGrade.setAdmission(null);

		return examGrade;
	}

}